package com.haoshuang.zhouzhoubang.ui.adapter

import android.graphics.Color
import com.chad.library.adapter4.BaseQuickAdapter
import com.haoshuang.zhouzhoubang.R
import com.haoshuang.zhouzhoubang.databinding.ItemTimec2Binding
import com.haoshuang.zhouzhoubang.model.bean.TimeBean8
import com.mufeng.libs.base.BaseBindingHolder
import com.mufeng.libs.base.BaseBindingQuickAdapter


class TimeCheckAdapter2(data: MutableList<TimeBean8.Timer>) :
    BaseBindingQuickAdapter<TimeBean8.Timer, ItemTimec2Binding>(data) {


    override fun onBindViewHolder(
        holder: BaseBindingHolder,
        position: Int,
        item: TimeBean8.Timer?
    ) {
        if (item == null) return
        val binding = ItemTimec2Binding.bind(holder.itemView)
        binding.apply {
            tvTime.text = item.time
            if (item.enable) {
                if (item.isCheck == 0) {
                    tvTime.setBackgroundResource(R.drawable.bg_8)
                    tvTime.setTextColor(Color.parseColor("#333333"))
                } else {
                    tvTime.setBackgroundResource(R.drawable.bg_8ls)
                    tvTime.setTextColor(Color.parseColor("#ffffff"))
                }
            } else {
                tvTime.setBackgroundResource(R.drawable.bg_8)
                tvTime.setTextColor(Color.parseColor("#999999"))
            }

        }
    }

}